<template>
  <div class="SalesDetail">
    <!-- 头部 --state-->
    <div class="side_1"></div>
    <span class="add_1">新增BOM表</span>
    <el-button type="info" icon="el-icon-back" class="btn_fanhui" @click="Fh">返回</el-button>

    <!-- 头部 --end-->
    <div class="addplan_box">
      <div class="from_sex">
        <el-row :gutter="5">
          <el-col :span="4">
            <el-form :model="formInline" class="demo-form-inline" label-width="83px">
              <el-form-item label="产品编号">
                <el-input v-model="formInline.year"></el-input>
              </el-form-item>
            </el-form>
          </el-col>
          <el-col :span="4">
            <el-form :model="formInline" class="demo-form-inline" label-width="83px">
              <el-form-item label="产品名称">
                <el-input v-model="formInline.month"></el-input>
              </el-form-item>
            </el-form>
          </el-col>
          <div class="from_btn">
            <!-- <el-button type="warning" size="mini" @click="dialogVisible=true">周计划</el-button> -->
          </div>
        </el-row>
      </div>
      <div class="bootom">BOM表</div>
      <el-table class="eldable" :data="tableData" style="width: 95%">
        <el-table-column prop="date" label="序号" width="150" align="center"></el-table-column>
        <el-table-column label="图号" width="150" align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.tuhao"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="名称" align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.mingc"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="材料" align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.cailiao"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="数量" width="150" align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.shuliang"></el-input>
          </template>
        </el-table-column>
        <el-table-column label="重量（KG）/面积（m2）" align="center">
          <el-table-column label="单件" width="120" align="center">
            <template slot-scope="scope">
              <el-input v-model="scope.row.danjian"></el-input>
            </template>
          </el-table-column>
          <el-table-column label="合计" width="120" align="center">
            <template slot-scope="scope">
              <el-input v-model="scope.row.heji"></el-input>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column prop="buwei" label="总成装配部件" align="center"></el-table-column>
        <el-table-column label="备注" align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.beizhu"></el-input>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="btn_bottom">
      <el-button type="primary" size="medium" @click="queDing">确定</el-button>
      <el-button type="info" size="medium" @click="quXiao">返回</el-button>
    </div>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data() {
    return {
      formInline: {},
      tableData: [
          {
             date:"", 
             tuhao:"", 
             mingc:"", 
             cailiao:"", 
             shuliang:"", 
             danjian:"", 
             buwei:"", 
             heji:"", 
             beizhu:"", 
          }
      ]
    };
  },
  created() {
    this.Id = this.$route.query.id;

    this.getval();
  },
  methods: {
    //详情数据
    getval() {
      axios(
        "apis/PurchasingManagement.asmx/Det_Purchase?index=5&no=" + this.Id
      ).then(({ data }) => {
        var datas = this.$x2js.xml2js(data);
        var list = JSON.parse(datas.string.__text);
        console.log(list);

        this.formInline.year = list.year;
        this.formInline.month = list.month;
        this.formInline.planno = list.planno;
        this.tableData = [];
        this.tableData = list.lstplan;
      });
    },
    Fh() {
      window.history.go(-1);
    },
    queDing() {
      window.history.go(-1);
    },
    quXiao() {
      window.history.go(-1);
    }
  }
};
</script>
<style lang="scss" scoped>
@import "@/assets/scss/base.scss";
.eldable{
    margin-left: 50px;
}
.side_1 {
  width: 5px;
  height: 16px;
  background-color: $Header_color;
  margin-left: 10px;
  margin-top: 20px;
}
.add_1 {
  margin-left: 20px;
  margin-top: -20px;
  float: left;
  font-size: 18px;
  font-weight: 400;
}
.btn_fanhui {
  margin-top: -20px;
  margin-right: 20px;
  float: right;
}
.addplan_box {
  background: $white;
  width: 98%;
  //   padding: 0 1%;
  margin-top: 50px;
  margin-left: 10px;
  border: 1px solid $bordercolor;
  border-radius: 4px;
  height: 670px;
  .addplan_table {
    margin-top: 30px;
    width: 98%;

    margin-left: 10px;
  }
}
.btn_bottom {
  text-align: center;
  margin-top: 30px;
}
.from_sex {
  margin-top: 20px;
  height: 60px;
  border-bottom: 20px solid #f5f3fb;
}
.bootom {
  height: 45px;
  line-height: 45px;
  padding-left: 20px;
  border-bottom: 1px solid #f1f1f1;
  margin-bottom: 20px;
}

.from_btn {
  margin-left: 90%;
}
</style>
<style>
#addplan_table .el-table th > .cell {
  text-align: center;
  padding: 0;
}
#addplan_table .el-input__inner {
  border: none;
  outline: none;
}
#addplan_table .el-table {
  font-size: 14px;
}
#addplan_table .el-table td,
.el-table th {
  padding: 0;
  height: 40px;
}
#addplan_table .el-table .cell {
  line-height: normal;
  padding: 0;
}
#addplan_table .el-table .cell,
.el-table--border td:first-child .cell,
.el-table--border th:first-child .cell {
  padding: 0;
}

</style>